package push_button.actions;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import junit.framework.TestCase;

import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Enumeration;
import org.eclipse.uml2.uml.EnumerationLiteral;
import org.eclipse.uml2.uml.Extension;
import org.eclipse.uml2.uml.Generalization;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.PrimitiveType;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Signal;
import org.eclipse.uml2.uml.Usage;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.uml2.uml.Package;

import com.cea.papyrus.core.commands.AddUMLElementToDiagram;
import com.cea.papyrus.core.commands.UMLElementCreateCommand;
import com.cea.papyrustest.uml.createcommand.AssociationCreateCommandTest;
import com.cea.papyrustest.uml.createcommand.PapyrusCommandTest;
import com.cea.papyrus.core.editor.MultiDiagramEditor;
import com.cea.papyrus.core.editor.abstracteditor.AbstractGraphicalPageWithFlyoutPalette;
import com.cea.papyrus.diagram.classdiagram.Activator;

/**
 * Our sample action implements workbench action delegate.
 * The action proxy will be created by the workbench and
 * shown in the UI. When the user tries to use the action,
 * this delegate will be created and execution will be 
 * delegated to it.
 * @see IWorkbenchWindowActionDelegate
 */
public class SampleAction implements IWorkbenchWindowActionDelegate {
	private IWorkbenchWindow window;
		
	/**
	 * The constructor.
	 */
	public SampleAction() {
	}
	
	private void ClassTest () {
		int NUMBER = 16;
		int STEP= 8;
		
		System.out.println("Class test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Class.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		Element elem=model.getPackagedElement("Class_15");
		if( elem == null || !(elem instanceof Class)) {
			throw new RuntimeException("Cannot find classes we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement("Class_15") != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem=model.getPackagedElement("Class_15");
		if( elem == null || !(elem instanceof Class)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void PackageTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("Package test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Package.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,400 + new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		Element elem =model.getPackagedElement("Package_9");
		if( elem == null || !(elem instanceof Package)) {
			throw new RuntimeException("Cannot find packages we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement("Package_9") != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem =model.getPackagedElement("Package_9");
		if( elem == null || !(elem instanceof Package)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void CommentTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("Comment test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Comment.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,800 + new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		List<Comment> comments = model.getOwnedComments();
		if( comments == null || comments.size() != NUMBER) {
			throw new RuntimeException("Cannot find comments we just created");
		}
		
		stack.undo();
		stack.undo();
		comments = model.getOwnedComments();
		if( comments == null || comments.size() != NUMBER-1) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		comments = model.getOwnedComments();
		if( comments == null || comments.size() != NUMBER) {
			throw new RuntimeException("redo failed");
		}
	}

	private void ConstraintTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("Constraint test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Constraint.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,1200 + new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		Element elem =model.getOwnedRule("Constraint9");
		if( elem == null || !(elem instanceof Constraint)) {
			throw new RuntimeException("Cannot find comments we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getOwnedRule("Constraint9") != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem =model.getOwnedRule("Constraint9");
		if( elem == null || !(elem instanceof Constraint)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void DataTypeTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("DataType test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.DataType.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,1600 + new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		String name = "DataType_"+(NUMBER-1);
		
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof DataType)) {
			throw new RuntimeException("Cannot find DataType we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof DataType)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void EnumTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("Enum test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Enumeration.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110 + 1000,1600 + new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		String name = "Enumeration_"+(NUMBER-1);
		
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Enumeration)) {
			throw new RuntimeException("Cannot find Enumeration we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Enumeration)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void EnumerationLiteralTest () {
		int NUMBER = 10;
		int STEP= 4;
		
		System.out.println("EnumerationLiteral test");
		
		Enumeration enumeration = null;
		for(int i = 0; i < NUMBER ; i++) {	
			String name = "Enumeration_"+i;
			enumeration =(Enumeration)model.getPackagedElement(name);
			UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.EnumerationLiteral.class, enumeration);
			stack.execute(papyrusCommand);
		}

		String name = "Literal_0";
				
		Element elem =enumeration.getOwnedLiteral(name);
		if( elem == null || !(elem instanceof EnumerationLiteral)) {
			throw new RuntimeException("Cannot find EnumerationLiteral we just created");
		}
		
		stack.undo();
		if( enumeration.getOwnedLiteral(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =enumeration.getOwnedLiteral(name);
		if( elem == null || !(elem instanceof EnumerationLiteral)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void ExtensionTest () {
		int NUMBER = 10;
		
		System.out.println("Extension test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Extension.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		String name = "Extension"+(NUMBER-1);
				
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Extension)) {
			throw new RuntimeException("Cannot find Extension we just created");
		}
		
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Extension)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void GeneralisationTest () {
		int NUMBER = 10;
		
		System.out.println("Generalisation test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Class.class,model);
		UMLElementCreateCommand papyrusCommand2 = null;
		Class [] theParent = new Class[NUMBER];
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
			theParent[i] = (Class)((UMLElementCreateCommand)papyrusCommand).getElement();
			papyrusCommand2 = new UMLElementCreateCommand(org.eclipse.uml2.uml.Generalization.class, theParent[i]);
			stack.execute(papyrusCommand2);
		}
				
		Element elem =theParent[NUMBER-1].getGeneralizations().get(0);
		if( elem == null || !(elem instanceof Generalization)) {
			throw new RuntimeException("Cannot find Generalization we just created");
		}
		
		stack.undo();
		if( theParent[NUMBER-1].getGeneralizations().size() != 0) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		if( theParent[NUMBER-1].getGeneralizations().size() != 1) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void InstanceSpecificationTest () {
		int NUMBER = 10;
		
		System.out.println("Instance Specification test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.InstanceSpecification.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		String name = "InstanceSpecification_"+(NUMBER-1);
				
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof InstanceSpecification)) {
			throw new RuntimeException("Cannot find InstanceSpecification we just created");
		}
		
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof InstanceSpecification)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void InterfaceTest () {
		int NUMBER = 16;
		int STEP= 8;
		
		System.out.println("Interface test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Interface.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110,2000+new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		String name = "Interface_"+(NUMBER-1);
		
		Element elem=model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Interface)) {
			throw new RuntimeException("Cannot find Interfaces we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem=model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Interface)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void ModelTest () {
		int NUMBER = 16;
		int STEP= 8;
		
		System.out.println("Model test");
		
		UMLElementCreateCommand papyrusCommand = new UMLElementCreateCommand(org.eclipse.uml2.uml.Model.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {
			stack.execute(papyrusCommand);
			Element elt=((UMLElementCreateCommand)papyrusCommand).getElement();
			AddUMLElementToDiagram addcommand=new AddUMLElementToDiagram(elt, ((AbstractGraphicalPageWithFlyoutPalette)papyrusEditor.getActiveEditor()).getDiagramModel(),new Point((i%STEP)*110+1000,2000+new Double(Math.floor(i/STEP)).intValue()*110),null);
			stack.execute(addcommand);
		}
		
		String name = "Model_"+(NUMBER-1);
		
		Element elem=model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Model)) {
			throw new RuntimeException("Cannot find Models we just created");
		}
		
		stack.undo();
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		stack.redo();
		elem=model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Model)) {
			throw new RuntimeException("redo failed");
		}
	}

	private void OperationTest () {
		int NUMBER = 10;
		
		System.out.println("Operation test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Class.class,model);
		UMLElementCreateCommand papyrusCommand2 = null;
		Class [] theParent = new Class[NUMBER];
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
			theParent[i] = (Class)((UMLElementCreateCommand)papyrusCommand).getElement();
			papyrusCommand2 = new UMLElementCreateCommand(org.eclipse.uml2.uml.Operation.class, theParent[i]);
			stack.execute(papyrusCommand2);
		}
				
		Element elem =theParent[NUMBER-1].getOwnedOperation("Operation_0", null, null);
		if( elem == null || !(elem instanceof Operation)) {
			throw new RuntimeException("Cannot find Operation we just created");
		}
		
		stack.undo();
		if( theParent[NUMBER-1].getOwnedOperation("Operation_0", null, null) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =theParent[NUMBER-1].getOwnedOperation("Operation_0", null, null);
		if( elem == null || !(elem instanceof Operation)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void PrimitiveTypeTest () {
		int NUMBER = 10;
		
		System.out.println("PrimitiveType test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.PrimitiveType.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		String name = "PrimitiveType_"+(NUMBER-1);
				
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof PrimitiveType)) {
			throw new RuntimeException("Cannot find PrimitiveType we just created");
		}
		
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof PrimitiveType)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private void ProfileTest () {
		int NUMBER = 10;
		
		System.out.println("Profile test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Profile.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		String name = "PrimitiveType_"+(NUMBER-1);
				
		Element elem =model.getNestedPackage(name);
		if( elem == null || !(elem instanceof Profile)) {
			throw new RuntimeException("Cannot find Profile we just created");
		}
		
		stack.undo();
		if( model.getNestedPackage(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =model.getNestedPackage(name);
		if( elem == null || !(elem instanceof Profile)) {
			throw new RuntimeException("redo failed");
		}
	}	
	
	private void SignalTest () {
		int NUMBER = 10;
		
		System.out.println("Signal test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Signal.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		String name = "Signal_"+(NUMBER-1);
				
		Element elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Signal)) {
			throw new RuntimeException("Cannot find Signal we just created");
		}
		
		stack.undo();
		if( model.getPackagedElement(name) != null) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		elem =model.getPackagedElement(name);
		if( elem == null || !(elem instanceof Signal)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private List getUsages(org.eclipse.uml2.uml.Package package_) {
		List usages = new ArrayList();
		Iterator it = package_.eContents().iterator();
		while(it.hasNext()) {
			Object element = it.next();
			if(element instanceof Usage) {
				usages.add(element);
			}
		}
		return usages;
	}
	
	private void UsageTest () {
		int NUMBER = 10;
		
		System.out.println("Usage test");
		UMLElementCreateCommand papyrusCommand= new UMLElementCreateCommand(org.eclipse.uml2.uml.Usage.class,model);
		
		for(int i = 0; i < NUMBER ; i++) {	
			stack.execute(papyrusCommand);
		}

		List usages = getUsages(model);
		if( usages.size() != NUMBER || !(usages.get(0) instanceof Usage)) {
			throw new RuntimeException("Cannot find Signal we just created");
		}
		
		stack.undo();
		usages = getUsages(model);
		if( usages.size() != NUMBER-1) {
			throw new RuntimeException("undo failed");
		}
		
		stack.redo();
		usages = getUsages(model);
		if( usages.size() != NUMBER || !(usages.get(0) instanceof Usage)) {
			throw new RuntimeException("redo failed");
		}
	}
	
	private IEditorPart editorPart;
	private Package model;
	private CommandStack stack;
	private MultiDiagramEditor papyrusEditor;
	
	/**
	 * The action has been activated. The argument of the
	 * method represents the 'real' action sitting
	 * in the workbench UI.
	 * @see IWorkbenchWindowActionDelegate#run
	 */
	public void run(IAction action) {
		MessageDialog.openInformation(
			window.getShell(),
			"Push_button Plug-in",
			"Hello, Mac world");
		
		while( !(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()instanceof MultiDiagramEditor)){}
		editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		model = ((MultiDiagramEditor)editorPart).getModelManager().getTopPackageFromUMLResource();
		stack = (CommandStack)editorPart.getAdapter(CommandStack.class);
		papyrusEditor = ((MultiDiagramEditor)editorPart);
		
		try {
			ClassTest ();
			PackageTest ();
			CommentTest ();
			ConstraintTest ();
			DataTypeTest ();
			EnumTest ();
			EnumerationLiteralTest();
			ExtensionTest ();
			
			// generates null pointer exception when you close the diagram
			//GeneralisationTest ();
			
			InstanceSpecificationTest();
			InterfaceTest ();
			ModelTest ();
			OperationTest ();
			
			// Parameter (N/A)
			
			PrimitiveTypeTest ();
			
			// property
			// reception
			
			SignalTest ();
			
			// slot
			// stereotype
			
			UsageTest();
		}
		catch (RuntimeException e) {
			e.printStackTrace();
		}
		
	}

	/**
	 * Selection in the workbench has been changed. We 
	 * can change the state of the 'real' action here
	 * if we want, but this can only happen after 
	 * the delegate has been created.
	 * @see IWorkbenchWindowActionDelegate#selectionChanged
	 */
	public void selectionChanged(IAction action, ISelection selection) {
	}

	/**
	 * We can use this method to dispose of any system
	 * resources we previously allocated.
	 * @see IWorkbenchWindowActionDelegate#dispose
	 */
	public void dispose() {
	}

	/**
	 * We will cache window object in order to
	 * be able to provide parent shell for the message dialog.
	 * @see IWorkbenchWindowActionDelegate#init
	 */
	public void init(IWorkbenchWindow window) {
		this.window = window;
	}
}